<?php
class IndexController extends Zend_Controller_Action
{
   public function indexAction()
   {
      $this->view->assign('title', 'HI, every body!');
   }
   
   public function menuAction()
   {
        $mainMenu = array(
            array('title'=>'Home', 'url'=>$this->view->url(array(), null, true)),
            array('title'=>'Browse Places', 'url'=>$this->view->url(array('controller'=>'place', 'action'=>'browse'), null, true)),
            array('title'=>'Articles', 'url'=>$this->view->url(array('controller'=>'articles'), null, true)),
            array('title'=>'About', 'url'=>$this->view->url(array('controller'=>'about'), null, true)),
        );
        $this->view->menu = $mainMenu;
        $this->_helper->viewRenderer->setResponseSegment('menu'); 
		// Co the de dang tao menu moi = cach gan $this->view->menu2 ...
		
   }
   public function searchAction()
   {	
		$form = new Zend_Form();
		$form->setMethod('post');
		
		$form->addElement('text','searchtext');
		$searchtextElement = $form->getElement('searchtext');
		$searchtextElement -> setLabel('Search');
		$searchtextElement->setDecorators(array(
               'ViewHelper',
               'Description',
               'Errors',
               array(array('data'=>'HtmlTag'), array('tag' => 'td')),
               array('Label', array('tag' => 'td')),
               array(array('row'=>'HtmlTag'),array('tag'=>'tr', 'openOnly'=>true))
		));
		
		
		$searchButton = new Zend_Form_Element_Image('searchbutton');
		$searchButton->setImage('/public/img/menu/search2.jpg')
            ->setAttribs(array('id' => 'searchButton',
                                       'type' => 'submit',
                                       'alt' => 'Search!'));      
        $searchButton->setDecorators(array(
               'ViewHelper',
               'Description',
               'Errors',
                array(array('data'=>'HtmlTag'), array('tag' => 'td')),
                array('Label', array('tag' => 'td')),
        ));
		
		$form->addElement($searchButton);
        $form->setDecorators(array(
               'FormElements',
               array(array('data'=>'HtmlTag'),array('tag'=>'table')),
               'Form'

        ));
		$this->view->searchform =$form;
   }
   
   public function productAction()
   {
		$productContent = array(
			array('title' =>'Apple-TV', 
			'image' => '/public/img/content/product/Apple-TV.png',
			'url'=>$this->view->url(array(), null, true)),
			array('title' =>'iMac', 
			'image' => '/public/img/content/product/iMac.png',
			'url'=>$this->view->url(array(), null, true)),
			array('title' =>'iPhone', 
			'image' => '/public/img/content/product/iPhone.png',
			'url'=>$this->view->url(array(), null, true)),
			array('title' =>'iPod-Shuffle', 
			'image' => '/public/img/content/product/iPod-Shuffle.png',
			'url'=>$this->view->url(array(), null, true)),
			array('title' =>'iPod',    
			'image' => '/public/img/content/product/iPod.png',
			'url'=>$this->view->url(array(), null, true)),
			array('title' =>'iPod-Nano',    
			'image' => '/public/img/content/product/iPod-Nano.png',
			'url'=>$this->view->url(array(), null, true)),		
		);
		$this->view->product = $productContent; 
   }
   
}